<template>
  <!-- 角色配置菜单 -->
  <div>
    <el-card>
      <template #header>
        <el-row> </el-row>
      </template>
      <el-table
        ref="enterpriseRef"
        :data="tableData"
        style="width: 100%; max-height: 61vh; height: 61vh"
        table-layout="fixed"
        v-loading="loading"
      >
        <el-table-column fixed min-width="70" prop="userName" label="角色名称" />
        <el-table-column prop="nickName" label="角色等级" />
        <el-table-column prop="roleId" label="用户角色" />
        <el-table-column fixed="right" label="操作" width="160">
          <template #default="scope">
            <el-button
              link
              type="primary"
              @click="edit(scope.$index, scope.row)"
              >编辑</el-button
            >
            <el-popover
              placement="top-start"
              title="删除操作"
              :width="200"
              trigger="click"
              :visible="visibleSS[scope.$index]"
            >
              <p>确定要进行删除吗?</p>
              <div style="text-align: right; margin: 0">
                <el-button
                  size="small"
                  text
                  @click="visibleSS[scope.$index] = false"
                  >取消</el-button
                >
                <el-button
                  size="small"
                  type="primary"
                  @click="del(scope.$index, scope.row)"
                  >确定</el-button
                >
              </div>
              <template #reference>
                <el-button
                  link
                  type="danger"
                  ref="buttonRefs"
                  @click="visibleSS[scope.$index] = true"
                  >删除</el-button
                >
              </template>
            </el-popover>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        layout="prev, pager, next, sizes"
        v-model:page-size="pagination.size"
        v-model:current-page="pagination.page"
        :total="pagination.total"
        @size-change="sizeChange"
        @current-change="pageChange"
        class="pagination"
      />
    </el-card>
  </div>
</template>

<script setup>
import { reactive, ref } from "vue";
import { getUserList, delUser } from "@/api/admin/index";
import { ElMessage } from "element-plus";

const pagination = reactive({
  page: 1,
  size: 10,
  total: 0,
});
const tableData = ref([]);
const condition = ref([]);
const loading = ref(false);
const visibleSS = ref([]);

const doDataList = ()=>{

}

const sizeChange = (value) => {
  pagination.size = value;
  pagination.page = 1;
  doDataList();
};
/**
 * 页总数改变
 */
const pageChange = (value) => {
  pagination.page = value;
  doDataList();
};
doDataList();
</script>

<style scoped></style>
